<?php

namespace App\Common\WX\App\qr;


use App\Common\Log;
use App\Common\WX\App\WxAppBase;
use App\Common\WX\App\WxAppCommon;
use App\Common\WX\WxWord;
use App\Model\t_wx_qr;
use App\Model\t_wx_reply;

class event extends WxAppBase
{
    function funcHandle(WxWord $word, $wx_from)
    {
        Log::funcLogDebug(__METHOD__);


        $data_wxqr = $this->context()->db()
            ->where('wxqr_x_id', $this->funcGetX())
            ->where('wxqr_info', $word->suffix())
            ->getOne(t_wx_qr::table());

        $entity_wxqr = t_wx_qr::funcArrayToEntity($data_wxqr);
        if ($entity_wxqr != null)
        {
            $now_word = new WxWord("reply#id:{$entity_wxqr->wxqr_reply_id}");
            $app = new WxAppCommon();
            $app->funcHandle($now_word, $wx_from);
        }
    }
}